Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate partitioning from globbing in cmdutil/args package and consumers #3

Open
wants to merge 2 commits into
base: 5099-gh-release-create-upload-expand-glob-patterns-on-windows
Choose a base branch
from

Conversation

jtmcg
Copy link

@jtmcg jtmcg commented Feb 26, 2025

Changes

In the previous commit, I think that GlobPaths was overloaded, containing logic specific to command use-cases. This removes that functionality from GlobPaths and puts it back into the commands that have the special use-cases.

To do this, I've introduced a new Partition util in cmdutil/args.go that will separate a slice into two slices given a predicate. This functionality is leveraged by both the special use-cases described above to separate the command-specific syntax from the globable filepaths.

Notes

This change doesn't preserve the order of arguments in gh gist create. Specifically, it'll move any passed in "-" to the end of the list of filepaths that are passed in as args. As far as I can tell, this shouldn't matter, and I've written a test to validate that hypothesis.

Testing

The need for handling these special use-cases was indicated by failing unit tests. Thus, I'm using the tests as behavior validation in this PR.

…mers

In the previous commit, GlobPaths was overloaded, containing logic
specific to command use-cases. This commit removes that functionality from
GlobPaths and back into the commands that have the special use-cases.

To do this, I've introduced a new Partition util in cmdutil/args.go that
will separate a slice into two slices given a predicate. This functionality
is leveraged by both the special use-cases described above to separate the
command-specific syntax from the globable filepaths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant